import request from '@/config/axios'

// 用户领取提货记录 VO
export interface PickUpUserRecordVO {
  id: number // 主键
  userId: number // 用户id
  activityId: number // 关联提货活动
  cardNo: string // 卡号
  cardPassword: string // 卡密
  orderIds: string // 提货关联订单列表
  startTime: Date // 提货开始时间
  endTime: Date // 提货结束时间
  status: number // 状态
  
}


export interface PickUpUserBindRecordVO {
  pickupId: number // 主键
  userId: number // 用户id
  pickupStoreId: number
  receiverName: string
  receiverMobile:string
}

// 用户领取提货记录 API
export const PickUpUserRecordApi = {
  // 查询用户领取提货记录分页
  getPickUpUserRecordPage: async (params: any) => {
    return await request.get({ url: `/pickup/record/page`, params })
  },

  // 查询用户领取提货记录详情
  getPickUpUserRecordById: async (id: number) => {
    return await request.get({ url: `/pickup/record/getById?id=` + id })
  },

  // 新增用户领取提货记录
  createPickUpUserRecord: async (data: PickUpUserRecordVO) => {
    return await request.post({ url: `/pickup/record/create`, data })
  },

   batchCreatePickUpUserRecord: async (data: PickUpUserRecordVO) => {
    return await request.post({ url: `/pickup/record/batchCreate`, data })
  },


  pickupByAdmin: async (data: PickUpUserBindRecordVO) => {
    return await request.post({ url: `/pickup/record/pickupByAdmin`, data })
  },

  bindUser: async (data: PickUpUserBindRecordVO) => {
    return await request.post({ url: `/pickup/record/bindUser`, data })
  },

  // 修改用户领取提货记录
  updatePickUpUserRecord: async (data: PickUpUserRecordVO) => {
    return await request.post({ url: `/pickup/record/update`, data })
  },

  // 修改用户领取提货记录状态
  updatePickUpUserRecordStatus: async (id: number, status: number) => {
    const data = {
      id,
      status
    }
    return await request.post({ url: `/pickup/record/updateStatus`, data: data })
  },

  // 删除用户领取提货记录
  deletePickUpUserRecordById: async (id: number) => {
    return await request.get({ url: `/pickup/record/delete?id=` + id })
  },

  // 导出用户领取提货记录 Excel
  exportPickUpUserRecord: async (params) => {
    return await request.download({ url: `/pickup/record/export-excel`, params })
  }
}